<?php

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;

class Parter extends BaseModel
{
    use SoftDeletes;

    public $table = 'parter';
    public $timestamps = 'true';

    //正常登录
    public const STATUS_NORMAL = 1;
    //禁止登录
    public const STATUS_DISABLE = 2;

    /**
     * 1:正常 2 禁用 3 离职
     */
    public static function getStatus($statusId = 0)
    {
        $statuses = [
            "1" => '正常',
            "2" => '禁用',
            "3" => '离职',
            "4" => '测试',
        ];

        if ($statusId) {
            return $statuses[$statusId] ?? "未知";
        }

        return $statuses;
    }

    /**
     * 用户菜单
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function roleMenuInfo(): \Illuminate\Database\Eloquent\Relations\HasMany
    {
        return $this->hasMany(RoleMenu::class, 'role_id', 'role_id');
    }

}
